#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->setGeometry(100,100,300,600);
    //创建按钮
    button=new QPushButton("按钮A",this);
    //定义按钮属性
    button->setGeometry(QRect(100,10,100,25));
    //给按钮添加插槽事件（点击事件）
    connect(button,
            SIGNAL(released()),
            this,SLOT(txtButton()));
    //Chapter003_1_2
    label=new QLabel("我是QLabel",this);
    label->setGeometry(QRect(100,50,200,30));
    label->setStyleSheet("font-size:20px;color:red;font-weight:bold;fontstyle:italic");
    //Chapter003_1_3
    lineEdit=new QLineEdit(this);
    lineEdit->setGeometry(QRect(100,100,200,25));
    lineEdit->setStyleSheet("border:1px;border-style:solid;color:red;border-color:red;");
    lineEdit->setMaxLength(12);
    lineEdit->setEchoMode(QLineEdit::Password);
    //Chapter003_1_4
    textEdit=new QTextEdit(this);
    textEdit->setGeometry(QRect(50,150,200,50));
    textEdit->setText("a<br/> <a href='http://www.baidu.com'>b</a>");
    //Chapter003_1_5
    plainTextEdit=new QPlainTextEdit(this);
    plainTextEdit->setGeometry(QRect(50,200,200,40));
    plainTextEdit->setPlainText("第一");
    //Chapter003_1_6
    comboBox=new QComboBox(this);
    comboBox->setGeometry(QRect(20,250,120,25));
    QStringList str;
    str <<"数学"<<"语文"<<"地理";
    comboBox->addItems(str);
    //
}
void MainWindow::txtButton()
{
  //改变按钮文字
    button->setText("按钮b");
}
MainWindow::~MainWindow()
{
    delete ui;
}
